package iconSwingStates.StateMachine;

import fr.emn.reactiveinput.In;
import iconSwingStates.Device.DSwingStatesDevice;
import iconSwingStates.Transitions.TGeneric;

import java.util.ArrayList;

/**
 * This class is a container for :
 *  - A transition
 *  - A transition name
 *  - A list of slots
 * This class is used within {@link DSwingStatesDevice} in order to be able to get the slots attached to a given transition.
 * @author uribe - gaget
 *
 */
public class InSwingStates{
	private String nomTransition;
	private TGeneric transition;
	private ArrayList<In> ins;
	private boolean synchro = false;
	/**
	 * Default constructor
	 * @param t The transition
	 */	
	public InSwingStates(TGeneric t){
		this.synchro = t.isSynchro();
		ins = new ArrayList<In>();
		transition  = t;
		nomTransition = t.getName();
	}

	/**
	 * Add a slot to the container
	 * @param in the slot
	 */
	public void addIn(In in){
		ins.add(in);
	}
	
	/**
	 * Returns the name of the transition
	 * @return the name
	 */
	public String getName(){
		return nomTransition;
	}

	 /**
	  * Return the transition
	  * @return the transition
	  */
	 public TGeneric getTransition(){
		 return transition;
	 }

	 /**
	  * Retourne les slots
	  * @return le ou les slot(s)
	  */
	 public ArrayList<In> getIns(){
		 return ins;
	 }

	 /**
	  * Indicate if the activity must be synchronized or not
	  * @return true if it must be synchronized, false otherwise
	  */
	 public boolean isSynchro(){
		 return synchro;
	 }
}